#include <bits/stdc++.h>
using namespace std;
string s;
long long len, k;
bool check(long long val) {
  long long i, x = 0, sp, hy, maxm;
  sp = -1;
  hy = -1;
  for (i = 0; i < len; i++) {
    x = x + 1;
    if (x == val) {
      if (s[i] == ' ' || s[i] == '-') {
        x = 0;
        k = k - 1;
      } else {
        if (i == len - 1) {
          x = 0;
          k = k - 1;
        } else {
          maxm = max(sp, hy);
          if (maxm == -1) return false;
          x = i - maxm;
          k = k - 1;
        }
      }
      sp = -1;
      hy = -1;
    } else {
      if (s[i] == '-') hy = i;
      if (s[i] == ' ') sp = i;
      if (i == len - 1) k = k - 1;
    }
  }
  if (k >= 0) return true;
  return false;
}
int main() {
  long long i, low, high, mid, temp;
  cin >> k;
  temp = k;
  getchar();
  getline(cin, s);
  len = s.length();
  low = 1;
  high = 10000000;
  while (high - low >= 5) {
    mid = (low + high) >> 1;
    k = temp;
    if (check(mid)) {
      high = mid;
    } else {
      low = mid + 1;
    }
  }
  for (i = low; i <= high; i++) {
    k = temp;
    if (check(i)) {
      cout << i << "\n";
      return 0;
    }
  }
  cout << "-1\n";
  return 0;
}
