#include <bits/stdc++.h>
using namespace std;
int fun(pair<int, int> x, pair<int, int> y) { return x.second < y.second; }
int main() {
  vector<pair<int, int> > vii;
  int n, k;
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    vii.push_back(make_pair(x, x % 10));
  }
  int sum;
  while (k > 0) {
    sort(vii.begin(), vii.end(), fun);
    sum = 0;
    int flg = 1;
    for (int i = 0; i < n; i++) {
      if (vii[i].first == 100)
        ;
      else
        flg = 0;
    }
    if (!flg) {
      for (int i = n - 1; i >= 0; i--) {
        if (vii[i].first >= 100) {
          sum += 10;
          continue;
        }
        if (k > 0) {
          int ink = ((vii[i].first + 10) / 10) * 10 - vii[i].first;
          if (ink > k) ink = k;
          k = k - ink;
          vii[i].first += ink;
          vii[i].second = vii[i].first % 10;
        }
        sum += vii[i].first / 10;
      }
    } else {
      sum = n * 10;
      break;
    }
  }
  printf("%d\n", sum);
  return 0;
}
