#include <bits/stdc++.h>
using namespace std;
struct Rule1 {
  bool operator()(const int &o1, const int &o2) { return o1 % 10 > o2 % 10; }
};
int main() {
  int n, k;
  while (cin >> n >> k) {
    int o[100005];
    int p[100005];
    int q[100005];
    int i;
    int sum = 0;
    for (i = 0; i < n; i++) {
      cin >> o[i];
      p[i] = o[i];
    }
    sort(o, o + n, Rule1());
    for (i = 0; i < n; i++) {
      if ((o[i] % 10) == 0) break;
      while ((o[i] % 10) != 0) {
        int cha;
        p[i] = (o[i] / 10 + 1) * 10;
        cha = p[i] - o[i];
        if (k >= cha) {
          o[i] = p[i];
          k -= cha;
        } else {
          o[i] = o[i] + k;
          k = 0;
        }
        if (k == 0) break;
        if (k > 0 && i == n - 1) break;
      }
      if (i == n - 1) break;
    }
    if (k > 0) {
      for (i = 0; i < n; i++) {
        int chaa;
        chaa = 100 - o[i];
        if (k >= chaa) {
          o[i] = 100;
          k -= chaa;
        } else {
          o[i] += k;
          k = 0;
        }
        if (k == 0) break;
        if (i == n - 1) break;
      }
    }
    for (i = 0; i < n; i++) {
      int gao;
      gao = o[i] / 10;
      sum += gao;
    }
    cout << sum << endl;
  }
  return 0;
}
