#include <bits/stdc++.h>
using namespace std;
int main() {
  pair<long long int, long long int> ar[100005];
  long long int n, k;
  scanf("%I64d%I64d", &n, &k);
  long long int i;
  for (i = 0; i < n; i++) {
    long long int x, y;
    scanf("%I64d", &x);
    y = ((x / 10 + 1) * 10 - x) % 10;
    ar[i] = make_pair(y, x);
  }
  sort(ar, ar + n);
  long long int sum = 0;
  for (i = 0; i < n; i++) {
    if (k - ar[i].first >= 0) {
      ar[i].second = ar[i].second + ar[i].first;
      k = k - ar[i].first;
      ar[i].first = 0;
    } else {
      ar[i].second = ar[i].second + k;
      ar[i].first = ar[i].first - k;
      k = 0;
      break;
    }
  }
  long long int ans = 0, sum1 = 0;
  if (k > 0) {
    for (i = 0; i < n; i++) {
      sum1 = sum1 + ar[i].second / 10;
      sum = sum + (100 - ar[i].second);
    }
    ans = (min(sum, k)) / 10;
    ans = ans + sum1;
    printf("%I64d", ans);
  }
  if (k <= 0) {
    for (i = 0; i < n; i++) {
      sum1 = sum1 + ar[i].second / 10;
    }
    printf("%I64d", sum1);
  }
  return 0;
}
