#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, d, cont = 0, ans = 0;
  string str[110], stra = "";
  scanf("%d %d", &n, &d);
  for (int i = 0; i < n; i++) stra += '1';
  for (int i = 0; i < d; i++) {
    cin >> str[i];
  }
  bool must = false;
  for (int i = 0; i < d; i++) {
    if (stra != str[i]) {
      if (must) {
        cont++;
      } else {
        cont = 1;
      }
      must = true;
    } else {
      must = false;
    }
    ans = max(ans, cont);
  }
  printf("%d\n", ans);
}
