#include <bits/stdc++.h>
using namespace std;
int n, d;
char str[101];
int main() {
  cin >> n >> d;
  int cnt = 0, ans = 0;
  for (int i = 0; i < d; i++) {
    cin >> str;
    if (count(str, str + n, '0') >= 1)
      cnt++;
    else
      cnt = 0;
    ans = max(cnt, ans);
  }
  cout << ans << endl;
  return 0;
}
