#include <bits/stdc++.h>
using namespace std;
const int oo = (int)1e9;
const double PI = 2 * acos(0.0);
const double eps = 1e-7;
int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};
int main() {
  int n, m;
  cin >> n >> m;
  string s;
  int mx = 0;
  int c = 0;
  for (int i = 0; i < m; i++) {
    cin >> s;
    int va = 0;
    for (int l = 0; l < ((int)((s).size())); l++)
      if (s[l] == '0') {
        c++;
        va = 1;
        break;
      }
    if (va == 0) {
      mx = max(mx, c);
      c = 0;
    }
  }
  cout << max(mx, c) << endl;
}
