You are given two tables A and B of size n × m. 

We define a sorting by column as the following: we choose a column and reorder the rows of the table by the value in this column, from the rows with the smallest value to the rows with the largest. In case there are two or more rows with equal value in this column, their relative order does not change (such sorting algorithms are called stable).

You can find this behavior of sorting by column in many office software for managing spreadsheets. Petya works in one, and he has a table A opened right now. He wants to perform zero of more sortings by column to transform this table to table B.

Determine if it is possible to do so, and if yes, find a sequence of columns to sort by. Note that you do not need to minimize the number of sortings.

Input

The first line contains two integers n and m (1 ≤ n, m ≤ 1500) — the sizes of the tables.

Each of the next n lines contains m integers a_{i,j} (1 ≤ a_{i, j} ≤ n), denoting the elements of the table A.

Each of the next n lines contains m integers b_{i, j} (1 ≤ b_{i, j} ≤ n), denoting the elements of the table B.

Output

If it is not possible to transform A into B, print -1.

Otherwise, first print an integer k (0 ≤ k ≤ 5000) — the number of sortings in your solution.

Then print k integers c_1, …, c_k (1 ≤ c_i ≤ m) — the columns, by which Petya needs to perform a sorting.

We can show that if a solution exists, there is one in no more than 5000 sortings.

Examples

Input


2 2
2 2
1 2
1 2
2 2


Output


1
1

Input


3 3
2 3 2
1 3 3
1 1 2
1 1 2
1 3 3
2 3 2


Output


2
1 2

Input


2 2
1 1
2 1
2 1
1 1


Output


-1

Input


4 1
2
2
2
1
1
2
2
2


Output


1
1 

Note

Consider the second example. After the sorting by the first column the table becomes

$$$\begin{matrix} 1&3&3\\\ 1&1&2\\\ 2&3&2. \end{matrix}$$$

After the sorting by the second column the table becomes

$$$\begin{matrix} 1&1&2\\\ 1&3&3\\\ 2&3&2, \end{matrix}$$$

and this is what we need.

In the third test any sorting does not change anything, because the columns are already sorted.
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  vector<vector<int>> a(n, vector<int>(m));
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) cin >> a[i][j];
  }
  vector<vector<int>> b(n, vector<int>(m));
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) cin >> b[i][j];
  }
  vector<vector<int>> bb;
  for (int i = 0; i < n; ++i) bb.push_back(b[i]);
  sort(bb.begin(), bb.end());
  bb.erase(unique(bb.begin(), bb.end()), bb.end());
  vector<vector<int>> who_a(bb.size());
  vector<vector<int>> who_b(bb.size());
  for (int i = 0; i < n; ++i) {
    int ind = lower_bound(bb.begin(), bb.end(), a[i]) - bb.begin();
    if (ind == (int)bb.size() || bb[ind] != a[i]) {
      cout << -1 << endl;
      return 0;
    }
    who_a[ind].push_back(i);
    ind = lower_bound(bb.begin(), bb.end(), b[i]) - bb.begin();
    who_b[ind].push_back(i);
  }
  vector<int> p(n);
  for (int i = 0; i < (int)bb.size(); ++i) {
    if (who_a[i].size() != who_b[i].size()) {
      cout << -1 << endl;
      return 0;
    }
    for (int j = 0; j < (int)who_a[i].size(); ++j) {
      p[who_a[i][j]] = who_b[i][j];
    }
  }
  vector<int> q(n);
  for (int i = 0; i < n; ++i) q[p[i]] = i;
  vector<bool> good(n, 0);
  vector<int> cnt_bad(m, 0), cnt_kek(m, 0);
  for (int j = 0; j < m; ++j) {
    for (int i = 0; i < n - 1; ++i) {
      if (a[q[i]][j] < a[q[i + 1]][j]) ++cnt_kek[j];
      if (a[q[i]][j] > a[q[i + 1]][j]) ++cnt_bad[j];
    }
  }
  vector<int> ans;
  while (true) {
    bool ok = true;
    for (int i = 0; i < n - 1; ++i) ok &= good[i] || q[i] < q[i + 1];
    if (ok) break;
    int col = -1;
    for (int j = 0; j < m; ++j) {
      if (cnt_bad[j] == 0 && cnt_kek[j] > 0) {
        col = j;
        break;
      }
    }
    if (col == -1) break;
    ans.push_back(col);
    for (int i = 0; i < n - 1; ++i) {
      if (!good[i] && a[q[i]][col] < a[q[i + 1]][col]) {
        good[i] = true;
        for (int j = 0; j < m; ++j) {
            if (a[q[i]][j] < a[q[i + 1]][j]) --cnt_kek[j];
            if (a[q[i]][j] > a[q[i + 1]][j]) --cnt_bad[j];
        }
      }
    }
  }
  bool ok = true;
  for (int i = 0; i < n - 1; ++i) ok &= good[i] || q[i] < q[i + 1];
  if (ok) {
    cout << (int)ans.size() << endl;
    reverse(ans.begin(), ans.end());
    for (int i : ans) cout << i + 1 << " ";
    cout << endl;
  } else {
    cout << -1 << endl;
  }
  return 0;
}
