#include <bits/stdc++.h>
using namespace std;
int n, d;
int cu_po[200002];
int nx_po[200002];
int up_co, dw_co;
void input() {
  scanf("%d %d", &n, &d);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &cu_po[i]);
  }
  for (int i = 1; i <= n; i++) {
    scanf("%d", &nx_po[i]);
    if (cu_po[i] > cu_po[d]) {
      up_co++;
    }
    if (cu_po[i] < cu_po[d]) {
      dw_co++;
    }
  }
}
void process() {
  int flag = 0;
  int maxx = 0;
  for (int i = 1; i <= n - dw_co; i++) {
    int count = 0;
    if (cu_po[i] + nx_po[n] <= cu_po[d] + nx_po[1]) {
      for (int j = i, cc = 0; j <= d; j++, cc++) {
        if (cu_po[j] + nx_po[n - cc] <= cu_po[d] + nx_po[1]) {
          count++;
        }
      }
    }
    if (count >= maxx) {
      maxx = count;
      flag = 1;
    } else if (flag == 1) {
      break;
    }
  }
  printf("%d", d - (maxx - 1));
}
int main() {
  input();
  process();
  return 0;
}
