#line 1 "Z-smawk.cpp"
#include <cstdio>
#include <cstdint>
#include <algorithm>
#include <numeric>
#include <stack>
#include <queue>
#include <vector>

#line 1 "~/git/library/utility/io.cpp"



/**
 * @brief 入出力
 * @author えびちゃん
 */

#include <cstddef>
#include <cctype>
#include <iomanip>
#include <iostream>
#include <tuple>
#include <utility>

class format {
public:
  using size_type = size_t;

private:
  char const* M_fmt;
  size_type M_nvars = 0;
  size_type M_error = -1;

  void M_print(std::ostream& os, char const* pos) const {
    while (*pos) {
      if (*pos == '{' || *pos == '}') ++pos;
      os << *pos++;
    }
  }

  template <typename Tp, typename... Args>
  void M_print(std::ostream& os, char const* pos, Tp const& x, Args const&... xs) const {
    while (true) {
      if (*pos == '{') {
        if (pos[1] == '{') {
          ++pos;
          os << '{';
        } else {
          char const* next = M_print_formatted(os, pos, x);
          return M_print(os, next, xs...);
        }
      } else {
        if (*pos == '}') ++pos;
        os << *pos;
      }
      ++pos;
    }
    char const* next = M_print_formatted(os, pos, x);
    M_print(os, next, xs...);
  }

  template <typename Tp>
  char const* M_print_formatted(std::ostream& os, char const* pos, Tp const& x) const {
    // parse flags, preferably
    while (*++pos != '}') {}
    os << x;
    return ++pos;
  }

  void M_scan(std::istream& is, char const* pos) const {
    while (true) {
      if (*pos == '{' || *pos == '}') ++pos;
      if (isspace(*pos)) {
        while (isspace(is.peek())) is.get();
      } else {
        if (is.peek() == *pos) {
          ++pos;
          is.get();
        } else {
          return;
        }
      }
    }
  }

  template <typename Tp, typename... Args>
  void M_scan(std::istream& is, char const* pos, Tp& x, Args&&... xs) const {
    while (true) {
      if (*pos == '{') {
        if (pos[1] == '{') {
          if (is.peek() == '{') {
            ++pos;
            is.get();
          } else {
            return;
          }
        } else {
          char const* next = M_scan_formatted(is, pos, x);
          return M_scan(is, next, xs...);
        }
      } else if (isspace(*pos)) {
        while (isspace(is.peek())) is.get();
        ++pos;
      } else {
        if (*pos == '}') ++pos;
        if (is.peek() == *pos) {
          ++pos;
          is.get();
        } else {
          return;
        }
      }
    }
  }

  template <typename Tp>
  char const* M_scan_formatted(std::istream& is, char const* pos, Tp& x) const {
    // parse flags, preferably
    while (*++pos != '}') {}
    is >> x;
    return ++pos;
  }

public:
  constexpr format(char const* fmt): M_fmt(fmt) {
    bool opens = 0;
    size_type i = 0;
    for (; fmt[i]; ++i) {
      if (fmt[i] == '{') {
        if (fmt[i+1] == '{') { ++i; continue; }  // escaped
        if (opens) { M_error = i; return; }
        opens = true;
      } else if (fmt[i] == '}') {
        if (fmt[i+1] == '}') { ++i; continue; }  // escaped
        if (!opens) { M_error = i; return; }
        opens = false;
        ++M_nvars;
      }
    }
    if (opens) { M_error = i; return; }
  }

  template <typename... Args>
  void print_(std::ostream& os, Args const&... xs) const {
    M_print(os, M_fmt, xs...);
  }

  template <typename... Args>
  void scan_(std::istream& is, Args&&... xs) const {
    M_scan(is, M_fmt, xs...);
  }

  constexpr size_type count() const { return M_nvars; }
  constexpr size_type error() const { return M_error; }
};

#define VA_COUNT(...)                                           \
  std::tuple_size<decltype(std::make_tuple(__VA_ARGS__))>::value

#define fprint(os, fmt, ...) (void)({                           \
      constexpr format fmt_(fmt);                               \
      constexpr size_t lhs = fmt_.count();                      \
      constexpr size_t rhs = VA_COUNT(__VA_ARGS__);             \
      static_assert(lhs == rhs, "size mismatch");               \
      static_assert(fmt_.error()+1 == 0, "misformatted");       \
      fmt_.print_(os, ##__VA_ARGS__);                           \
    })

#define fprintln(os, fmt, ...) (void)({         \
      fprint(os, fmt, ##__VA_ARGS__);           \
      os << '\n';;                              \
    })

#define print(...) fprint(std::cout, ##__VA_ARGS__)
#define println(...) fprintln(std::cout, ##__VA_ARGS__)
#define eprint(...) fprint(std::cerr, ##__VA_ARGS__)
#define eprintln(...) fprintln(std::cerr, ##__VA_ARGS__)

#define fscan(is, fmt, ...) (void)({                            \
      constexpr format fmt_(fmt);                               \
      constexpr size_t lhs = fmt_.count();                      \
      constexpr size_t rhs = VA_COUNT(__VA_ARGS__);             \
      static_assert(lhs == rhs, "size mismatch");               \
      static_assert(fmt_.error()+1 == 0, "misformatted");       \
      fmt_.scan_(is, ##__VA_ARGS__);                            \
    })

#define scan(...) fscan(std::cin, __VA_ARGS__)

__attribute__((constructor))
void ioinit() {
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(nullptr);
  std::cerr.tie(nullptr);
  std::cout << std::fixed << std::setprecision(16);
}


#line 1 "~/git/library/utility/literals.cpp"



/**
 * @brief ユーザ定義リテラル
 * @author えびちゃん
 */

#line 11 "~/git/library/utility/literals.cpp"

constexpr intmax_t  operator ""_jd(unsigned long long n) { return n; }
constexpr uintmax_t operator ""_ju(unsigned long long n) { return n; }
constexpr size_t    operator ""_zu(unsigned long long n) { return n; }
constexpr ptrdiff_t operator ""_td(unsigned long long n) { return n; }

constexpr int8_t   operator ""_i8(unsigned long long n)  { return n; }
constexpr int16_t  operator ""_i16(unsigned long long n) { return n; }
constexpr int32_t  operator ""_i32(unsigned long long n) { return n; }
constexpr int64_t  operator ""_i64(unsigned long long n) { return n; }
constexpr uint8_t  operator ""_u8(unsigned long long n)  { return n; }
constexpr uint16_t operator ""_u16(unsigned long long n) { return n; }
constexpr uint32_t operator ""_u32(unsigned long long n) { return n; }
constexpr uint64_t operator ""_u64(unsigned long long n) { return n; }


#line 1 "~/git/library/utility/limits.cpp"



/**
 * @brief 型依存の定数
 * @author えびちゃん
 */

#include <limits>
#line 11 "~/git/library/utility/limits.cpp"

template <typename Tp>
class limits: public std::numeric_limits<Tp> {};

template <typename T1, typename T2>
class limits<std::pair<T1, T2>> {
public:
  static constexpr auto min() {
    return std::make_pair(limits<T1>::min(), limits<T2>::min());
  }
  static constexpr auto max() {
    return std::make_pair(limits<T1>::max(), limits<T2>::max());
  }
};


#line 1 "~/git/library/utility/make/fix_point.cpp"
/**
 * @brief ラムダ式の再帰
 * @author えびちゃん
 */

#ifndef H_make_fix_point
#define H_make_fix_point

#line 10 "~/git/library/utility/make/fix_point.cpp"

template <typename Fn>
class fix_point: Fn {
public:
  explicit constexpr fix_point(Fn&& f) noexcept: Fn(std::forward<Fn>(f)) {}

  template <typename... Args>
  constexpr decltype(auto) operator ()(Args&&... args) const {
    return Fn::operator ()(*this, std::forward<Args>(args)...);
  }
};

template <typename Fn>
static inline constexpr decltype(auto) make_fix_point(Fn&& f) noexcept {
  return fix_point<Fn>{std::forward<Fn>(f)};
}

#endif  /* !defined(H_make_fix_point) */
#line 13 "Z-smawk.cpp"

namespace detail {
template <typename Fn>
class totally_monotone_minima {
public:
  using size_type = size_t;
  using value_type = decltype(std::declval<Fn>()(0, 0));
  using function_type = Fn;

private:
  function_type M_f;
  size_type M_h, M_w;
  std::vector<size_type> M_res;

  void M_reduce(std::vector<size_type>& is, std::vector<size_type>& js) {
    std::stack<value_type> qy;
    std::deque<size_type> qj;
    auto it = is.begin();
    for (auto j: js) {
      size_type i = *it;
      while (!qy.empty()) {
        if (M_f(i, j) < qy.top()) {
        // if (!(qy.top() < M_f(i, j))) {
          qy.pop();
          qj.pop_back();
          if (it != is.begin()) i = *--it;
        } else {
          ++it;
          break;
        }
      }
      if (it == is.end()) {
        --it;
        continue;
      }
      i = *it;
      qy.push(M_f(i, j));
      qj.push_back(j);
    }
    js.assign(qj.begin(), qj.end());

    M_interpolate(is, js);
  }

  void M_base_step(std::vector<size_type>& is, std::vector<size_type>& js) {
    if (is.size() == 1) {
      M_res[is[0]] = js[0];
      return;
    }
    if (js.size() == 1) {
      M_res[is[0]] = M_res[is[1]] = js[0];
      return;
    }
    size_type i0 = is[0];
    size_type i1 = is[1];
    size_type j0 = js[0];
    size_type j1 = js[1];
    M_res[i0] = M_res[i1] = j0;
    if (M_f(i0, j1) < M_f(i0, j0)) {
      M_res[i0] = M_res[i1] = j1;  // from totally-monotonicity
    } else if (M_f(i1, j1) < M_f(i1, j0)) {
      M_res[i1] = j1;
    }
  }

  void M_interpolate(std::vector<size_type>& is, std::vector<size_type>& js) {
    if (is.size() <= 2) {
      M_base_step(is, js);
      return;
    }

    std::vector<size_type> i0, i1;
    i0.reserve((is.size()+1)/2);
    i1.reserve(is.size()/2);
    for (size_type i = 0; i < is.size(); i += 2) i0.push_back(is[i]);
    for (size_type i = 1; i < is.size(); i += 2) i1.push_back(is[i]);
    {
      auto tmp = js;
      M_process(i1, tmp);
    }

    std::queue<size_type> stop;
    for (auto i: i1) stop.push(M_res[i]);
    stop.push(js.back()+1);
    for (auto it = i0.begin(), jt = js.begin(); jt != js.end();) {
      size_type i = *it;
      size_type j = *jt;
      if (M_f(i, j) < M_f(i, M_res[i])) M_res[i] = j;
      if (stop.front() == j) {
        if (++it == i0.end()) break;
        stop.pop();
      } else {
        ++jt;
      }
    }
  }

  void M_build() {
    size_type h = M_h;
    size_type w = M_w;
    std::vector<size_type> is(h), js(w);
    std::iota(is.begin(), is.end(), 0_zu);
    std::iota(js.begin(), js.end(), 0_zu);
    M_process(is, js);
  }

  void M_process(std::vector<size_type>& is, std::vector<size_type>& js) {
    (is.size() < js.size())? M_reduce(is, js): M_interpolate(is, js);
  }

public:
  totally_monotone_minima(function_type f, size_type h, size_type w):
    M_f(f), M_h(h), M_w(w), M_res(h) { M_build(); }

  std::vector<size_type> output() const { return M_res; }
};
}  // detail::

template <typename Fn>
std::vector<size_t> totally_monotone_minima(Fn f, size_t h, size_t w) {
  return detail::totally_monotone_minima<Fn>(f, h, w).output();
}

template <typename Fn>
auto online_to_offline_optimization(Fn&& f, size_t n, decltype(f(n, n)) init = 0) {
  using value_type = decltype(f(n, n));
  std::vector<value_type> dp(n, limits<value_type>::max());
  dp[0] = init;

  auto induce = [&](size_t l, size_t m, size_t r) -> void {
    auto g = [&](size_t i, size_t j) -> value_type {
      return dp[j+l] + f(j+l, i+m);
    };
    auto argmin = totally_monotone_minima(g, r-m, m-l);
    for (size_t i = m; i < r; ++i) {
      size_t j = argmin[i-m] + l;
      dp[i] = std::min(dp[i], g(i-m, j-l));
    }
  };

  make_fix_point([&](auto& solve, size_t l, size_t r) -> void {
      if (l+1 == r) {
        if (r < n) dp[r] = std::min(dp[r], dp[l] + f(l, r));
        return;
      }
      size_t m = (l+r) >> 1;
      solve(l, m);
      induce(l, m, r);
      solve(m, r);
  })(0, n);
  return dp;
}

int main() {
  size_t n;
  int64_t c;
  scan("{} {}", n, c);

  std::vector<int64_t> h(n);
  for (auto& hi: h) scan("{}", hi);

  auto f = [&](size_t il, size_t ir) -> int64_t {
    return (h[ir]-h[il]) * (h[ir]-h[il]) + c;
  };

  auto res = online_to_offline_optimization(f, n);
  println("{}", res[n-1]);
}


Measured memory_bytes: 13556