// Arup Guha
// 6/23/2025
// Solution to Kattis Problem: Architecture
// https://open.kattis.com/problems/architecture

// Note: A much easier solution exists (it's possible iff max of both lists are equal)

using namespace std;
#include <bits/stdc++.h>

int main() {

    int r, c;
    cin >> r >> c;

    // Will store values here.
    vector<vector<int>> grid(r, vector<int>(c,0));

    vector<pair<int,int>> obj;

    // I store each row value as a pair, height followed by index.
    vector<int> east(r);
    for (int i=0; i<r; i++) {
        cin >> east[i];
        obj.push_back(pair<int,int>(east[i], i));
    }

    // Each column value is height followed by index + row (to distinguish from rows)
    vector<int> north(c);
    for (int i=0; i<c; i++) {
        cin >> north[i];
        obj.push_back(pair<int,int>(north[i], r+i));
    }

    // Sort by height.
    sort(obj.begin(), obj.end());

    // Process each item in order.
    for (int i=0; i<obj.size(); i++) {

        // The height.
        int val = obj[i].first;

        // Fill in this row.
        if (obj[i].second < r) {
            int id = obj[i].second;
            for (int j=0; j<c; j++) {
                if (grid[id][j] == 0)
                    grid[id][j] = val;
            }
        }

        // Fill in this column.
        else {
            int id = obj[i].second-r;
            for (int j=0; j<r; j++) {
                if (grid[j][id] == 0)
                    grid[j][id] = val;
            }
        }
    }

    // We'll set this to false if the data doesn't match.
    bool flag = true;

    // Check each row.
    for (int i=0; i<r; i++) {

        // Find actual max/
        int big = grid[i][0];
        for (int j=1; j<c; j++)
            big = max(big, grid[i][j]);

        // Update flag if it doesn't match.
        if (big != east[i]) flag = false;
    }

    // Check each column.
    for (int i=0; i<c; i++) {

        // Find the max on this column.
        int big = grid[0][i];
        for (int j=1; j<r; j++)
            big = max(big, grid[j][i]);

        // Update flag if it doesn't work.
        if (big != north[i]) flag = false;
    }

    // Ta da!
    if (flag)
        cout << "possible" << endl;
    else
        cout << "impossible"  << endl;

    return 0;
}

