#include <bits/stdc++.h>
using namespace std;
long long s[100007];
long long l[100007];
int main() {
  long long n, k, r = 0;
  cin >> n >> k;
  map<int, int> m;
  map<int, int> e[10];
  long long ki = 0;
  for (int i = 0; i < n; i++) {
    scanf("%I64d", &s[i]);
    r += s[i] / 10;
    if (s[i] != 100) {
      m[10 - (s[i] % 10)]++;
    }
    if ((s[i] % 10) == 0) {
      ki += (10 - s[i] / 10);
    }
    if (s[i] / 10 <= 9) {
      e[s[i] / 10][10 - (s[i] % 10)]++;
    }
  }
  map<int, int>::iterator it;
  for (it = m.begin(); it != m.end() && k > 0; it++) {
    long long gap = it->first;
    if (gap == 10) {
      break;
    }
    long long tot = it->second;
    if (gap * tot <= k) {
      if (gap < 10) {
        k -= gap * tot;
        r += tot;
        m[10] += tot;
        m[gap] = 0;
        for (int i = 9; i > 0; i--) {
          e[i][10] += e[i - 1][gap];
          ki += (10 - i) * e[i - 1][gap];
        }
        m[10] -= e[9][gap];
      } else if (gap == 10) {
        r += tot;
      }
    } else {
      r += (k / gap);
      m[10] += (k / gap);
      k = 0;
    }
  }
  if (it != m.end() && k > 0) {
    long long gap = it->first;
    long long tot = it->second;
    if (gap * ki <= k) {
      r += ki;
    } else {
      r += (k / gap);
    }
  }
  cout << r;
  return 0;
}
