#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int h, n;
  cin >> h >> n;
  vector<long long int> store(n + 1);
  store[0] = h;
  for (int i = 1; i < n + 1; i++) {
    cin >> store[i];
    store[i] += store[i - 1];
  }
  long long int ans = LLONG_MAX, d = store[0] - store[n];
  for (int i = 1; i < n + 1; i++) {
    if (store[i] <= 0) {
      ans = i;
      cout << ans << "\n";
      return 0;
    } else if (d > 0) {
      long long int temp = i + (store[i] + d - 1) / d * n;
      ans = min(ans, temp);
    }
  }
  if (ans == LLONG_MAX)
    cout << "-1\n";
  else
    cout << ans << "\n";
}
