#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
char a[110];
int main() {
  int n, d;
  int num = 0, sum = 0, m = -1;
  cin >> n >> d;
  for (int i = 0; i < d; i++) {
    num = 0;
    cin >> a;
    for (int j = 0; j < n; j++) {
      if (a[j] == '0') num++;
    }
    if (num)
      sum++;
    else
      sum = 0;
    m = max(m, sum);
  }
  cout << m << endl;
  return 0;
}
