#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, k;
  cin >> n >> k;
  k--;
  long long* ranks = new long long[n];
  long long* score = new long long[n];
  for (int i = 0; i < n; i++) {
    cin >> ranks[i];
  }
  for (int i = 0; i < n; i++) {
    cin >> score[i];
  }
  if (n == 1 || k == 1) {
    cout << "1" << endl;
    return 0;
  }
  long long win = ranks[k] + score[0];
  int j = n;
  for (int i = k - 1; i >= 0; i--) {
    if (ranks[i] + score[n - 1] < win)
      j = i;
    else
      break;
  }
  if (j == n) {
    cout << ++k << endl;
    return 0;
  }
  int up = j, lo = k, ans = n;
  while (lo >= up) {
    j = up + (lo - up) / 2;
    long long mark = ranks[j] + score[n - 1];
    int i = 0;
    while (mark < win && j + i < k && i < n) {
      i++;
      mark = ranks[j + i] + score[n - 1 - i];
    }
    if (j + i != k) {
      up = j + 1;
    } else {
      ans = min(ans, j);
      lo = j - 1;
    }
  }
  cout << ++ans << endl;
  return 0;
}
