#include <bits/stdc++.h>
using namespace std;
const int MAXN = (int)1e5 + 7;
int n, k;
vector<pair<int, int> > a;
int main() {
  scanf("%d %d", &n, &k);
  int sum = 0;
  for (int i = 0; i < n; ++i) {
    int x;
    scanf("%d", &x);
    int left = ((x / 10) + 1) * 10 - x;
    a.push_back(pair<int, int>(left, x));
    sum += x / 10;
  }
  sort(a.begin(), a.end());
  for (int i = 0; i < n; ++i) {
    if (a[i].first + a[i].second <= 100 && k >= a[i].first) {
      k -= a[i].first;
      a[i].second += a[i].first;
      a[i].first = 0;
      sum++;
    } else if (k < a[i].first)
      return printf("%d\n", sum), 0;
  }
  if (k)
    for (int i = 0; i < n; ++i) {
      int toInc = min((100 - a[i].second), k);
      sum += toInc / 10;
      a[i].second += toInc;
      k -= toInc;
    }
  printf("%d\n", sum);
}
