#include <bits/stdc++.h>
using namespace std;
const long long int maxn = 1e5 + 5;
pair<long long int, long long int> c[maxn];
int main() {
  long long int n, k, i, a1, p, sum1 = 0, p1, p2, sum2 = 0;
  cin >> n >> k;
  for (i = 1; i <= n; i++) {
    cin >> a1;
    p = a1 % 10;
    c[i].first = 10 - p;
    c[i].second = a1;
  }
  sort(c + 1, c + n + 1);
  for (i = 1; i <= n; i++) {
    if ((c[i].first) <= k) {
      c[i].second = c[i].second + c[i].first;
      if (c[i].second > 100) {
        c[i].second = 100;
        c[i].first = 0;
      }
      sum2 = sum2 + (100 - (c[i].second));
      sum1 = sum1 + (c[i].second / 10);
      k = k - c[i].first;
    } else {
      sum1 = sum1 + (c[i].second / 10);
      k = 0;
    }
  }
  p1 = 0;
  if (k > 0) {
    p1 = k / 10;
    p2 = sum2 / 10;
    if (p1 > p2) {
      p1 = p2;
    }
  }
  cout << sum1 + p1;
}
