#include <bits/stdc++.h>
using namespace std;
void bringToTen(int &k, int &rating, vector<int> &bucket) {
  for (int i = 9; i > 0; i--) {
    int x = 0;
    while (x < 100) {
      int h = min(k / (10 - i), bucket[x + i]);
      k -= h * (10 - i);
      bucket[x + 10] += h;
      rating += h;
      bucket[x + i] -= h;
      x += 10;
    }
  }
}
void addToTen(int &k, int &rating, vector<int> &bucket) {
  int x = 0;
  while (x < 100) {
    int h = min(k / 10, bucket[x]);
    rating += h;
    bucket[x + 10] += h;
    bucket[x] -= h;
    k -= 10 * h;
    x += 10;
  }
}
int main(void) {
  int n, k, rating = 0, h;
  scanf(" %d %d", &n, &k);
  vector<int> a(n);
  for (int(i) = (0); i < (n); i++) scanf(" %d", &a[i]);
  vector<int> num(101, 0);
  for (int(i) = (0); i < (n); i++) {
    num[a[i]]++;
    rating += a[i] / 10;
  }
  bringToTen(k, rating, num);
  addToTen(k, rating, num);
  printf("%d\n", rating);
  return 0;
}
