#include <bits/stdc++.h>
using namespace std;
char s[1000010];
int a[1000010];
int k, tot;
bool check(int x) {
  int cnt = 0;
  int cntk = k - 1;
  int pre = 0;
  for (int i = 1; i <= tot; i++) {
    cnt++;
    if (cnt > x) {
      if (cntk == 0) return false;
      bool flag = false;
      int tmp = -1;
      for (int j = pre + 1; j < i; j++) {
        if (a[j] == 1) {
          tmp = j;
          flag = true;
        }
      }
      if (flag == false) return false;
      cntk--;
      cnt -= (tmp - pre);
      pre = tmp;
    }
  }
  return true;
}
int main() {
  scanf("%d", &k);
  getchar();
  char c;
  while ((c = getchar()) != '\n') {
    s[++tot] = c;
    if (s[tot] == ' ' || s[tot] == '-') {
      a[tot] = 1;
    }
  }
  int l = 1, r = tot;
  int ans = -1;
  while (l <= r) {
    int mid = (l + r) / 2;
    if (check(mid)) {
      ans = mid;
      r = mid - 1;
    } else {
      l = mid + 1;
    }
  }
  printf("%d\n", ans);
}
