#include <bits/stdc++.h>
using namespace std;
int n;
int k;
char str[1000100];
bool after[1000100];
int nex[1000100];
bool check(int width) {
  int start = 0;
  for (int i = 0; i < k; i++) {
    int currlen = 0;
    while (true) {
      int ne = nex[start];
      int delta = 0;
      if (ne == -1)
        delta = n - start;
      else
        delta = ne - start;
      if (currlen + delta <= width) {
        currlen += delta;
        start = ne;
        if (ne == -1) break;
      } else {
        break;
      }
    }
    if (start == -1) return true;
  }
  return false;
}
int main() {
  scanf("%d\n", &k);
  string str;
  getline(cin, str);
  n = str.length();
  for (int i = 0; i < n; i++) {
    if (isspace(str[i]) || str[i] == '-') {
      after[i] = true;
    }
  }
  nex[n - 1] = -1;
  for (int i = n - 2; i >= 0; i--) {
    if (after[i])
      nex[i] = i + 1;
    else
      nex[i] = nex[i + 1];
  }
  int lo = 1, hi = n, ans = -1;
  while (lo <= hi) {
    int width = (lo + hi) / 2;
    if (check(width)) {
      ans = width;
      hi = width - 1;
    } else
      lo = width + 1;
  }
  printf("%d\n", ans);
  return 0;
}
