#include <bits/stdc++.h>
int main() {
  int n;
  int m;
  int x = 1000000;
  int a[50];
  int b[50];
  int z = 0;
  unsigned int c[50];
  unsigned int d[50];
  std::cin >> n >> m;
  for (int i = 0; i < n; ++i) {
    std::cin >> a[i];
  }
  for (int i = 0; i < m; ++i) {
    std::cin >> b[i];
  }
  for (int i = 0; i < n; ++i) {
    c[i] = a[i];
  }
  for (int i = 0; i < m; ++i) {
    d[i] = b[i];
  }
  for (int j = 0; j < n; ++j) {
    int ans = 100000;
    for (int i = 0; i < m; ++i) {
      if (x >= (c[z] - d[i]) + (c[z] - d[i + 1])) {
        x = (c[z] - d[i]) + (c[z] - d[i + 1]);
        ans = i + 1;
      }
    }
    std::cout << ans << std::endl;
    z += 1;
  }
  return 0;
}
