#include <bits/stdc++.h>
using namespace std;
bool comp(int a, int b) { return ((a % 10) > (b % 10)); }
int main() {
  int n, k, tmp;
  int level = 0, diff;
  vector<int> a;
  cin >> n >> k;
  for (int i = 0; i < n; ++i) {
    cin >> tmp;
    a.push_back(tmp);
  }
  sort(a.begin(), a.end(), comp);
  for (int i = 0; i < n; ++i) {
    diff = (10 - (a[i] % 10)) % 10;
    if (diff <= k) {
      if ((diff == 0 && a[i] < 100) || diff != 0) {
        k -= diff;
        a[i] += diff;
      }
    }
    level += a[i] / 10;
  }
  for (int i = 0; i < n; ++i) {
    if (k < 10) break;
    if (a[i] < 100) {
      diff = 10 - a[i] / 10;
      if (diff < k / 10) {
        level += diff;
        k -= diff * 10;
      } else {
        level += k / 10;
        k = 0;
      }
    }
  }
  cout << level << endl;
  return 0;
}
