#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[]) {
  int d, n, c, ans, m;
  string arr[105];
  cin >> n >> d;
  ans = 0;
  m = 0;
  for (int i = 0; i < d; i++) {
    cin >> arr[i];
    c = 0;
    for (int j = 0; j < n; j++) {
      if (arr[i][j] == '1') c++;
    }
    if (c < n)
      m++;
    else
      m = 0;
    if (m > ans) ans = m;
  }
  cout << ans << endl;
  return 0;
}
