#include <bits/stdc++.h>
using namespace std;
string a[123];
bool b[1234];
int pos[1234];
int main() {
  int m, n;
  cin >> m >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    for (int j = 0; j < m; j++) {
      if (a[i][j] == '0') {
        b[i] = 1;
        break;
      }
    }
  }
  for (int i = 0; i < n; i++) {
    if (i == 0) {
      if (b[i])
        pos[i] = 1;
      else
        pos[i] = 0;
      continue;
    }
    if (b[i]) {
      pos[i] = pos[i - 1] + 1;
    } else
      pos[i] = 0;
  }
  int res = 0;
  for (int i = 0; i < n; i++) {
    if (pos[res] < pos[i]) res = i;
  }
  cout << pos[res];
}
