#include <bits/stdc++.h>
using namespace std;
int n, k;
int main() {
  scanf("%d%d", &n, &k);
  int s, count = 0;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &s);
    if (s + k <= 5) {
      count++;
    }
  }
  cout << count / 3;
}
