#include <bits/stdc++.h>
using namespace std;
int mod = 1000000007;
int main() {
  int t, n, m, i, x = 0, y = 0;
  cin >> n >> m;
  m = 5 - m;
  for (i = 0; i < n; i++) {
    cin >> y;
    if (y <= m) x++;
  }
  cout << x / 3;
}
