#include <bits/stdc++.h>
using namespace std;
int main() {
  int h = 0, n, k, y, sum = 0;
  cin >> n;
  cin >> k;
  for (int i = 0; i < n; i++) {
    cin >> y;
    if (y + k <= 5) h++;
    if (h == 3) {
      sum++;
      h = 0;
    }
  }
  cout << sum;
  return 0;
}
