#include <bits/stdc++.h>
using namespace std;
void dark_knight() {
  long long n;
  cin >> n;
  long long arr[8] = {0};
  long long sum = 0;
  for (long long i = 1; i < 8; i++) {
    cin >> arr[i];
    sum += arr[i];
  }
  long long flag = 7;
  n %= sum;
  if (n == 0) {
    while (flag > 0) {
      if (arr[flag] > 0) {
        cout << flag;
        return;
      }
      flag--;
    }
  }
  for (long long i = 1; i <= 7; i++) {
    if (n <= arr[i]) {
      cout << i;
      return;
    }
    n -= arr[i];
  }
}
int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long t = 1;
  while (t--) {
    dark_knight();
  }
  return 0;
}
