#include <bits/stdc++.h>
using namespace std;
int main() {
  char a[105];
  int arya[105];
  int n, d;
  cin >> n >> d;
  int add = 0;
  int maxi = 0;
  if (cin.fail()) {
    cin.clear();
    cin.ignore(32767, '\n');
  }
  for (int i = 0; i < d; ++i) {
    int sum = 0;
    for (int j = 0; j < n; ++j) {
      cin >> a[j];
      if (a[j] == '0')
        arya[i] = 1;
      else
        sum++;
    }
    if (sum == n) arya[i] = 0;
    for (int j = 0; j < d; ++j) {
      if (arya[j] == 1) {
        add++;
        maxi = max(maxi, add);
      } else
        add = 0;
    }
  }
  cout << maxi << endl;
  return 0;
}
