#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int n, d[7], t;
  while (cin >> n) {
    t = 0;
    for (int i = 0; i < 7; ++i) {
      cin >> d[i];
      t += d[i];
    }
    n %= t;
    if (n == 0) {
      for (int i = 6; i >= 0; --i) {
        if (d[i] != 0) {
          cout << i + 1 << endl;
          break;
        }
      }
    } else {
      int i;
      for (i = 0; i < 7 && n > 0; ++i) {
        n -= d[i];
      }
      cout << i << endl;
    }
  }
  return 0;
}
