#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, d, sum = 0, ans = 0;
  cin >> n >> d;
  string *s = new string[d];
  for (int i = 0; i < d; i++) cin >> s[i];
  for (int i = 0; i < d; i++) {
    int flag = 0;
    for (int k = 0; k < n; k++) {
      if (s[i][k] == '0') {
        flag = 1;
        break;
      }
    }
    if (flag)
      ans++;
    else
      ans = 0;
    sum = max(sum, ans);
  }
  cout << sum << endl;
}
