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