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